package servlets;

import dao.UserEntityFacadeLocal;
import java.io.IOException;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import utils.Menu;
import utils.MenuItem;

/**
 * @author andrei costache
 */
public abstract class UserController extends BaseServletController {
	
	@EJB UserEntityFacadeLocal userDAO;

        @Override
	public void doRequest(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
            HttpSession session = request.getSession();
            //Construct the submenu to be displayed.
            Menu tabs = new Menu();
            if (session.getAttribute("user") != null){
               tabs.addItem(new MenuItem("View", "/user/profile"));
               tabs.addItem(new MenuItem("Edit", "/user/profile/edit"));
            }
            request.setAttribute("tabs", tabs);
        }
	
}
